/*
 * @Description:
 * @Author: shilinzhou
 * @Date: 2024-01-24 19:06:55
 * @LastEditors: shilinzhou
 * @LastEditTime: 2024-02-23 13:37:34
 */
import { ParamsPage, ResponsePage } from '@/api/common/type';

// 请求参数
export type GanttParams = SearchParams & ParamsPage;

export interface SearchParams {
    deviceName: string;
    workshopName: string;
    planStartTime: string;
    planEndTime: string;
    orderNumber?: string;
    materialCode?: string;
    materialName?: string;
    rangeDate?: {
        start: string;
        end: string;
    };
}

// 返回数据
export interface ganttDataResponse {
    planStartTime?: string;
    planEndTime?: string;
    ganttDatas?: GanttDatas;
    localDateSortedSet?: string[];
    rows?: OrderLoad;
}

export interface GanttDatas extends ResponsePage {
    records: Records[];
}

export interface Records {
    [key: string]: any;
    workshopName?: string;
    deviceName?: string;
    deviceId?: number;
    numberOfTasks?: number;
    rowIndex?: number;
    ganttList?: GanttList[];
    id?: number;
    orderNO?: string;
    planStartDate?: string;
    planEndDate?: string;
    node?: {
        parentMaterialCode: string;
        materialCode: string;
        materialName: string;
        planStartDate: string;
        planEndDate: string;
        id?: number;
        hide?: boolean;
        hideRow?: boolean;
        children: Children[];
        dataMap: {
            [key: string]: DataMap;
        };
    };
}

export interface GanttList {
    orderNumber?: string;
    planStartTime?: string;
    planEndTime?: string;
    materialCode?: string;
    materialName?: string;
    processNumber?: string;
    processName?: string;
    quantity?: number;
    id?: number;
    planProcessStatus?: string;
    actualProcessStatus?: string;
    planCnt?: number;
    completedCnt?: number;
    processSchedule?: number;
}

export interface OrderResponse {
    localDateSortedSet: string[];
    rows: OrderLoad;
}

export type OrderLoad = ResponseListCommon<OrderLoadProp>;

export interface OrderLoadProp {
    id: number;
    orderNO: string;
    planStartDate: string;
    planEndDate: string;
    node: {
        parentMaterialCode: string;
        materialCode: string;
        materialName: string;
        planStartDate: string;
        planEndDate: string;
        children: Children[];
        dataMap: {
            [key: string]: DataMap;
        };
    };
}

export interface DataMap {
    processNumber: number;
    processName: string;
    planProcessStatus: string;
    actualProcessStatus: string;
    planCnt: number;
    completedCnt: number;
    processSchedule: number;
    planStartTime: string;
    planEndTime: string;
}

export interface Children {
    materialCode: string;
    materilName: string;
    parentMaterialCode: string;
    dataMap: {
        [key: string]: DataMap;
    };
}
